package com.ruoyi.audit.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.audit.mapper.AuditMapper;
import com.ruoyi.audit.domain.Audit;
import com.ruoyi.audit.service.IAuditService;

/**
 * 审批Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-07-08
 */
@Service
public class AuditServiceImpl implements IAuditService 
{
    @Autowired
    private AuditMapper auditMapper;

    /**
     * 查询审批
     * 
     * @param id 审批主键
     * @return 审批
     */
    @Override
    public Audit selectAuditById(Long id)
    {
        return auditMapper.selectAuditById(id);
    }

    /**
     * 查询审批列表
     * 
     * @param audit 审批
     * @return 审批
     */
    @Override
    public List<Audit> selectAuditList(Audit audit)
    {
        return auditMapper.selectAuditList(audit);
    }

    /**
     * 新增审批
     * 
     * @param audit 审批
     * @return 结果
     */
    @Override
    public int insertAudit(Audit audit)
    {
        audit.setCreateTime(DateUtils.getNowDate());
        return auditMapper.insertAudit(audit);
    }

    /**
     * 修改审批
     * 
     * @param audit 审批
     * @return 结果
     */
    @Override
    public int updateAudit(Audit audit)
    {
        audit.setUpdateTime(DateUtils.getNowDate());
        return auditMapper.updateAudit(audit);
    }

    /**
     * 批量删除审批
     * 
     * @param ids 需要删除的审批主键
     * @return 结果
     */
    @Override
    public int deleteAuditByIds(Long[] ids)
    {
        return auditMapper.deleteAuditByIds(ids);
    }

    /**
     * 删除审批信息
     * 
     * @param id 审批主键
     * @return 结果
     */
    @Override
    public int deleteAuditById(Long id)
    {
        return auditMapper.deleteAuditById(id);
    }
}
